<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNoticesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $table_name = 'notices';
        Schema::create($table_name, function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('tenant_id')->index()->comment('租户ID');
            $table->string('title')->comment('公告名称');
            $table->string('content')->comment('公告内容');
            $table->text('info')->nullable()->comment('公告详情');
            $table->boolean('is_enable')->default(true)->comment('是否启用');
            $table->integer('sort')->default(0)->comment('排序(值越大越靠前)');
            $table->timestamps();
        });
        add_table_comment($table_name, '公告通知表');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('notices');
    }
}
